<style>
    iframe {
        border-width: 0px;

    }
    .c_box{
        margin:5px;
        cursor: pointer;
    }
    .cur{
        color:red;
    }

</style>

{$pid}
<div class="content">

                                <div class="bs-bars pull-left" style="width:50%;float: left">
<div>
                                    <form action="" method="post" id="js_sub">

                                            <div style="margin-bottom: 10px;">
                                                <span class="c_box {if condition='$search.p_type eq 100'} cur {/if}" d_box="0">全部</span>
                                                {volist name="product_type" id="product_type" key="k"}
                                                <span d_box="{$k}" class="c_box {if condition='$search.p_type eq $k'} cur {/if}">{$product_type}</span>
                                                {/volist}
                                                <input type="hidden" name="type"  id="js_box"/>
                                            </div>
                                            <div style="margin-bottom: 10px;">
                                                ID <input type="text" name="id" value="{$search.id}" style="width:120px;"/>
                                                产品编号 <input type="text" name="p_no" value="{$search.p_no}" style="width:120px;"/>
                                                天数 <input type="text" name="p_day" value="{$search.p_day}" style="width:120px;"/>
                                                名称 <input type="text" name="p_name" value="{$search.p_name}" style="width:120px;"/>

                                                <input type="submit" value="搜索"/>
                                            </div>
                                        </form>

                                </div>
    <div>
                                <table  class="table table-striped table-bordered table-hover table-nowrap" data-operate-edit="1" data-operate-del="1" width="100%">
                                    <thead>

                                    <tr>

                                        <th style="text-align: center; vertical-align: middle;" data-field="id">
                                            <div class="th-inner ">ID</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center; vertical-align: middle;" data-field="pno">
                                            <div class="th-inner ">产品编号</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center; vertical-align: middle;width:200px;" data-field="p_name">
                                            <div class="th-inner ">名称</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center; vertical-align: middle;" data-field="type">
                                            <div class="th-inner ">产品类型</div>
                                            <div class="fht-cell"></div>
                                        </th>

                                        <th style="text-align: center; vertical-align: middle;width: 20%;" data-field="operate">
                                            <div class="th-inner ">操作</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                    </tr>
                                    </thead>
                                    <tbody data-listidx="0">
                                    {volist name="list" id="vo"}
                                    <tr data-index="0">
                                        <td style="text-align: center; vertical-align: middle; ">
                                            {$vo.id}
                                        </td>
                                        <td style="text-align: center; vertical-align: middle; ">
                                            {$vo.p_no}
                                        </td>
                                        <td style="vertical-align: middle;width:400px;white-space: normal;">
                                            <a target="_blank"  href="/index/show/detail?id={$vo.id}"> {$vo.p_name}</a>
                                        </td>

                                        <td style="text-align: center; vertical-align: middle; ">
                                            <?php echo getstr("product-p_type",$vo['p_type']);?>
                                        </td>

                                        <td style="text-align: center; vertical-align: middle; ">

                                            <div class="optiontext">
                                                <a  target="c_p_select" href="/admin/product/index_product_link?pid={$pid}&action=add&addid={$vo.id}" class="btn btn-success btn-edit" title="加入"> 加入</a>
                                            </div>

                                        </td>
                                    </tr>
                                    {/volist}
                                    </tbody>
                                </table>
                                <div>{$list->render();}</div>

</div></div>
                                    <div style="width:47%;float:right;" id="divR">
                                        <iframe id="c_p_select"  name="c_p_select"  height="1000px"; width="100%"  border="0"src="/admin/product/index_product_link?pid={$pid}&type=0">

                                        </iframe>
                                    </div>
                                    <div style="clear:both"></div>

</div>
<script language="javascript" type="text/javascript" src="/assets/My97DatePicker/jquery-1.8.2.js"></script>
<script>
    function markAdd(id){
        //alert(id);
        var pid="{$pid}";
        var flag=1;
        $.ajax({
            url:"/admin/product/markAdd",
            type:'post',
            data:{"id":id,"pid":pid,"flag":flag},
            datatype:'json',
            success:function(data){
                var url="/admin/product/index_product_mark?pid={$pid}&type=0";
                if(data==1){
                    $("#c_p_select").attr("src",url);
                }else if(data==2){
                    alert("该数据已存在");
                }else{
                    alert("添加失败");
                }

            }
        })
    }

    function customAdd(){
        var pid="{$pid}";
        var info=$("#custom").val();
        var flag=0;
        if(info==''){
            alert("自定义标签不得为空");
            return false;
        }
        //alert(info);
        $.ajax({
            url:'/admin/product/markAdd',
            type:'post',
            datatype:'json',
            data:{"info":info,"pid":pid,"flag":flag},
            success:function(data){
                var url="/admin/product/index_product_mark?pid={$pid}&type=0";
                if(data==1){
                    $("#c_p_select").attr("src",url);
                }else if(data==2){
                    alert("该数据已存在");
                }else{
                    alert("添加失败");
                }
            }
        })
    }

</script>
<script language="javascript" type="text/javascript" src="/assets/My97DatePicker/jquery-1.8.2.js"></script>
<script>
    $(".c_box").click(function(){
        var type=$(this).attr("d_box");
        //alert(type);
        $("#js_box").val(type);
        console.log( $("#js_box").val(type))
        //$(this).submit();
        $("#js_sub").submit();

    })
</script>

